<%@page contentType="text/html" pageEncoding="UTF-8" import="df.jsp.LabelMap" errorPage="../error.jsp"%>
<%@page import="df.bean.db.conn.DBConnection"%>
<%@page import="df.bean.obj.util.Utils"%>
<%@ include file="../../_global.jsp" %>
<%    if (session.getAttribute("LANG_CODE") == null)
        session.setAttribute("LANG_CODE", LabelMap.LANG_EN);
    
    LabelMap labelMap = new LabelMap(session.getAttribute("LANG_CODE").toString());
	labelMap.add("TITLE_MAIN", "Master Data", "รายงานข้อมูลพื้นฐาน");
	labelMap.add("REPORT_NAME", "Report Name", "ชื่อรายงาน");
    labelMap.add("UPDATE_FROM_DATE", "From Date", "เริ่ม วันที่");
    labelMap.add("UPDATE_TO_DATE", "To Date", "สิ้นสุด วันที่");
    labelMap.add("UPDATE_From_TIME", "From Time", "เริ่ม เวลา");
    labelMap.add("UPDATE_To_TIME", "To Time", "สิ้น เวลา");
    labelMap.add("ACCOUNT_CODE","Account Code","รหัสการลงบัญชี");
    labelMap.add("BANK_CODE","Bank Code","รหัสธนาคาร");
    labelMap.add("DEPARTMENT_CODE","Department Code","รหัสแผนก");
    labelMap.add("DOCTOR_CATE_CODE","Doctor Category Code","รหัสประเภทแพทย์");
    labelMap.add("EXPENSE_CODE","Expense Code","รหัสค่าใช้จ่าย");
    labelMap.add("LOCATION_CODE","Location Code","รหัสที่ตั้งแผนก");
    labelMap.add("ORDER_ITEM_CATE_CODE","OrderItemCategory Code","รหัสประเภทรายการรักษา");
    labelMap.add("ORDER_ITEM_CODE","OrderItem Code","รหัสรายการรักษา");
    labelMap.add("PAYOR_OFFICE_CODE","PayorOffice Code","รหัสบริษัทคู่สัญญา");
    labelMap.add("RECEIPT_TYPE_CODE","ReceiptType Code","รหัสประเภทการรับเงิน");
	labelMap.add("REPORT_ACCOUNT","Account","ข้อมูลรหัสการลงบัญชี");
	labelMap.add("REPORT_BANK","Bank","ข้อมูลธนาคาร");
	labelMap.add("REPORT_DEPARTMENT","Department","ข้อมูลแผนก");
	labelMap.add("REPORT_DOCTOR_CATEGORY","Doctor Category","ข้อมูลประเภทแพทย์");
	labelMap.add("REPORT_DOCTOR", "Doctor", "ข้อมูลแพทย์");
	labelMap.add("REPORT_DOCTOR_TIME", "Doctor Time", "ข้อมูลตารางเวลาแพทย์");
	labelMap.add("REPORT_EXPENSE","Expense","ข้อมูลค่าใช้จ่าย");
	labelMap.add("REPORT_LOCATION","Location","ข้อมูลที่ตั้งแผนก");
	labelMap.add("REPORT_ORDER_ITEM_CATEGORY", "Order Item Category", "ข้อมูลประเภทรายการรักษา");
	labelMap.add("REPORT_ORDER_ITEM", "Order Item", "ข้อมูลรายการรักษา");
	labelMap.add("REPORT_PAYOR_OFFICE", "Payor Office", "ข้อมูลบริษัทคู่สัญญา");
	labelMap.add("REPORT_RECEIPT_TYPE","Receipt Type","ข้อมูลประเภทการรับเงิน");
	labelMap.add("REPORT_STP_METHOD_ALLOC_ITEM_CATEGORY","Stp Method Alloc Item Category","ข้อมูลเงื่อนไขระดับกลุ่มรายการ");
	labelMap.add("REPORT_STP_METHOD_ALLOC_ITEM","Stp Method Alloc Item","ข้อมูลเงื่อนไขระดับรายการ");
	labelMap.add("REPORT_STP_METHOD_ALLOC_MASTER","Stp Method Alloc Master","ข้อมูลเงื่อนไขระดับกลุ่ม");
	labelMap.add("REPORT_STP_METHOD_ALLOC_PERSONAL","Stp Method Alloc Personal","เงื่อนไขระดับแพทย์ ");
	labelMap.add("SAVE_FILE", "Save as filename", "จัดเก็บไฟล์ชื่อ");
	labelMap.add("VIEW", "View", "แสดงผล");
	String report = "";
    request.setAttribute("labelMap", labelMap.getHashMap());
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>${labelMap.TITLE_MAIN}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="../../css/share.css" media="all" />
        <link rel="stylesheet" type="text/css" href="../../css/calendar.css" />
        <script type="text/javascript" src="../../javascript/ajax.js"></script>
        <script type="text/javascript" src="../../javascript/calendar.js"></script>
        <script type="text/javascript" src="../../javascript/search_form.js"></script>
        <script type="text/javascript" src="../../javascript/util.js"></script>
        <script type="text/javascript">
        //---- Account Mr.Om ---
		        function ACCOUNT_CODE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.ACCOUNT_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_ACCOUNT() {
                var target = "../../RetrieveData?TABLE=ACCOUNT&COND=CODE='" + document.mainForm.ACCOUNT_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_ACCOUNT);
            }
       function AJAX_Handle_Refresh_ACCOUNT() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.ACCOUNT_CODE.value = "";
                        document.mainForm.DESCRIPTION.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.DESCRIPTION.value = getXMLNodeValue(xmlDoc, "DESCRIPTION");
                }
            }
		//-- end Account
        //---- Bank Mr.Om ---
		        function BANK_CODE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.BANK_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_BANK() {
                var target = "../../RetrieveData?TABLE=BANK&COND=CODE='" + document.mainForm.BANK_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_BANK);
            }
       function AJAX_Handle_Refresh_BANK() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.BANK_CODE.value = "";
                        document.mainForm.BANK_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.BANK_NAME.value = getXMLNodeValue(xmlDoc, "DESCRIPTION_" + "<%= labelMap.getFieldLangSuffix()%>");
                }
            }
		//-- end Bank
		//---- Department Mr.Om ---
		        function DEPARTMENT_CODE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.DEPARTMENT_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_DEPARTMENT() {
                var target = "../../RetrieveData?TABLE=DEPARTMENT&COND=CODE='" + document.mainForm.DEPARTMENT_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_DEPARTMENT);
            }
       function AJAX_Handle_Refresh_DEPARTMENT() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.DEPARTMENT_CODE.value = "";
                        document.mainForm.DEPARTMENT_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.DEPARTMENT_NAME.value = getXMLNodeValue(xmlDoc, "DESCRIPTION");
                }
            }
		//-- end Department	
		//---- DOCTOR_CATE Mr.Om ---
		        function DOCTOR_CATE_CODE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.DOCTOR_CATE_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_DOCTOR_CATE() {
                var target = "../../RetrieveData?TABLE=DOCTOR_CATEGORY&COND=CODE='" + document.mainForm.DOCTOR_CATE_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_DOCTOR_CATE);
            }
       function AJAX_Handle_Refresh_DOCTOR_CATE() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.DOCTOR_CATE_CODE.value = "";
                        document.mainForm.DOCTOR_CATE_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.DOCTOR_CATE_NAME.value = getXMLNodeValue(xmlDoc, "DESCRIPTION");
                }
            }
		//-- end DOCTOR_CATE
		//---- DOCTOR Mr.Om ---
		        function DOCTOR_CODE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.DOCTOR_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_DOCTOR() {
                var target = "../../RetrieveData?TABLE=DOCTOR&COND=CODE='" + document.mainForm.DOCTOR_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_DOCTOR);
            }
       function AJAX_Handle_Refresh_DOCTOR() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.DOCTOR_CODE.value = "";
                        document.mainForm.DOCTOR_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.DOCTOR_NAME.value = getXMLNodeValue(xmlDoc, "NAME_" + "<%= labelMap.getFieldLangSuffix()%>");
                }
            }
		//-- end DOCTOR	
		//---- EXPENSE Mr.Om ---
		        function EXPENSE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.EXPENSE_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_EXPENSE() {
                var target = "../../RetrieveData?TABLE=EXPENSE&COND=CODE='" + document.mainForm.EXPENSE_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_EXPENSE);
            }
       function AJAX_Handle_Refresh_EXPENSE() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.EXPENSE_CODE.value = "";
                        document.mainForm.EXPENSE_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.EXPENSE_NAME.value = getXMLNodeValue(xmlDoc, "DESCRIPTION");
                }
            }
		//-- end EXPENSE	
		//---- LOCATION Mr.Om ---
		        function LOCATION_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.LOCATION_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_LOCATION() {
                var target = "../../RetrieveData?TABLE=LOCATION&COND=CODE='" + document.mainForm.LOCATION_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_LOCATION);
            }
       function AJAX_Handle_Refresh_LOCATION() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.LOCATION_CODE.value = "";
                        document.mainForm.LOCATION_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.LOCATION_NAME.value = getXMLNodeValue(xmlDoc, "DESCRIPTION");
                }
            }
		//-- end LOCATION
		//---- ORDER_ITEM_CATE Mr.Om ---
		        function ORDER_ITEM_CATE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.ORDER_ITEM_CATE_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_ORDER_ITEM_CATE() {
                var target = "../../RetrieveData?TABLE=ORDER_ITEM_CATEGORY&COND=CODE='" + document.mainForm.ORDER_ITEM_CATE_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_ORDER_ITEM_CATE);
            }
       function AJAX_Handle_Refresh_ORDER_ITEM_CATE() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.ORDER_ITEM_CATE_CODE.value = "";
                        document.mainForm.ORDER_ITEM_CATE_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.ORDER_ITEM_CATE_NAME.value = getXMLNodeValue(xmlDoc, "DESCRIPTION_"+"<%= labelMap.getFieldLangSuffix() %>");
                }
            }
		//-- end ORDER_ITEM_CATE
		//---- ORDER_ITEM Mr.Om ---
		        function ORDER_ITEM_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.ORDER_ITEM_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_ORDER_ITEM() {
                var target = "../../RetrieveData?TABLE=ORDER_ITEM&COND=CODE='" + document.mainForm.ORDER_ITEM_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_ORDER_ITEM);
            }
       function AJAX_Handle_Refresh_ORDER_ITEM() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.ORDER_ITEM_CODE.value = "";
                        document.mainForm.ORDER_ITEM_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.ORDER_ITEM_NAME.value = getXMLNodeValue(xmlDoc, "DESCRIPTION_"+"<%= labelMap.getFieldLangSuffix() %>");
                }
            }
		//-- end ORDER_ITEM	
		//---- PAYOR_OFFICE Mr.Om ---
		        function PAYOR_OFFICE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.PAYOR_OFFICE_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_PAYOR_OFFICE() {
                var target = "../../RetrieveData?TABLE=PAYOR_OFFICE&COND=CODE='" + document.mainForm.PAYOR_OFFICE_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_PAYOR_OFFICE);
            }
       function AJAX_Handle_Refresh_PAYOR_OFFICE() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.PAYOR_OFFICE_CODE.value = "";
                        document.mainForm.PAYOR_OFFICE_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.PAYOR_OFFICE_NAME.value = getXMLNodeValue(xmlDoc, "NAME_"+"<%= labelMap.getFieldLangSuffix() %>");
                }
            }
		//-- end PAYOR_OFFICE
		//---- RECEIPT_TYPE Mr.Om ---
		        function RECEIPT_TYPE_KeyPress(e) {
                var key = window.event ? window.event.keyCode : e.which;    // ? IE : Firefox

                if (key == 13) {
                    document.mainForm.RECEIPT_TYPE_CODE.blur();
                    return false;
                }
                else {
                    return true;
                }
            }
		function AJAX_Refresh_RECEIPT_TYPE() {
                var target = "../../RetrieveData?TABLE=RECEIPT_TYPE&COND=CODE='" + document.mainForm.RECEIPT_TYPE_CODE.value + "'";
                AJAX_Request(target, AJAX_Handle_Refresh_RECEIPT_TYPE);
            }
       function AJAX_Handle_Refresh_RECEIPT_TYPE() {
                if (AJAX_IsComplete()) {
                    var xmlDoc = AJAX.responseXML;
                    // Data not found
                    if (!isXMLNodeExist(xmlDoc, "CODE")) {
                       document.mainForm.RECEIPT_TYPE_CODE.value = "";
                        document.mainForm.RECEIPT_TYPE_NAME.value = "";
                        return;
                    }                   
                    // Data found
                    document.mainForm.RECEIPT_TYPE_NAME.value = getXMLNodeValue(xmlDoc, "DESCRIPTION_"+"<%= labelMap.getFieldLangSuffix() %>");
                }
            }
		//-- end RECEIPT_TYPE
		//-- onload Mr.Om
		function loadpage()
		{
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		}
		//-- end 
		//---- CHANGEDROPDOWNLIST Mr.Om ---
		function changeDropDownList(){
		if(document.mainForm.REPORT_FILE_NAME.value == "None" || document.mainForm.REPORT_FILE_NAME.value == "StpMedhodAllocItemCatMasters" || document.mainForm.REPORT_FILE_NAME.value == "StpMedhodAllocItemsMasters" 
        || document.mainForm.REPORT_FILE_NAME.value == "StpMedhodAllocMasters" || document.mainForm.REPORT_FILE_NAME.value == "StpMedhodAllocPersMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		}
		if(document.mainForm.REPORT_FILE_NAME.value == "AccountMasters"){
		document.getElementById('account').style.display = "inline";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		}
		if(document.mainForm.REPORT_FILE_NAME.value == "BankMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "inline";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		}
		if(document.mainForm.REPORT_FILE_NAME.value == "Dept_Masters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "inline";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		 }
		if(document.mainForm.REPORT_FILE_NAME.value == "DoctorCateMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "inline";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		 }
		if(document.mainForm.REPORT_FILE_NAME.value == "DoctorMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "inline";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		 }
		if(document.mainForm.REPORT_FILE_NAME.value == "ExpenseMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "inline";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		 }
		if(document.mainForm.REPORT_FILE_NAME.value == "Loc_Masters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "inline";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		 }
		if(document.mainForm.REPORT_FILE_NAME.value == "OrderItemCateMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "inline";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		 }
		if(document.mainForm.REPORT_FILE_NAME.value == "OrderItemMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "inline";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "none";
		}
		if(document.mainForm.REPORT_FILE_NAME.value == "PayorOfficeMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "inline";
		document.getElementById('receipt_type').style.display = "none";
		}
		if(document.mainForm.REPORT_FILE_NAME.value == "ReceiptTypeMasters"){
		document.getElementById('account').style.display = "none";
		document.getElementById('bank').style.display = "none";
		document.getElementById('department').style.display = "none";
		document.getElementById('doctor_cate').style.display = "none";
		document.getElementById('doctor').style.display = "none";
		document.getElementById('expense').style.display = "none";
		document.getElementById('location').style.display = "none";
		document.getElementById('order_item_cate').style.display = "none";
		document.getElementById('order_item').style.display = "none";
		document.getElementById('payor_office').style.display = "none";
		document.getElementById('receipt_type').style.display = "inline";
		}	
		}
            function Report_View() {
			    if(document.mainForm.REPORT_FILE_NAME.value == "None"){
                    alert("Please Select Report");
                    document.mainForm.REPORT_FILE_NAME.focus();
                }else{
					document.mainForm.REPORT_DISPLAY.value = "view";
					document.mainForm.target = "_blank";
					document.mainForm.submit();
            	}
			}
			function Report_Save() {
				if(document.mainForm.REPORT_FILE_NAME.value == "None"){
                    alert("Please Select Report");
                    document.mainForm.REPORT_FILE_NAME.focus();
                }else{
					document.mainForm.REPORT_DISPLAY.value = "save";
					document.mainForm.target = "_blank";
					document.mainForm.submit();
				}
			}
		</script>
    </head>
	<body onload ="loadpage();">
        
        <form id="mainForm" name="mainForm" method="get" action="../../ViewReportSrvl">
            <center>
		<table width="800" border="0">
		<tr><td align="left">
		<b><font color='#003399'><%=Utils.getInfoPage("master_report.jsp", labelMap.getFieldLangSuffix(), new DBConnection()) %></font></b>
		</td></tr>
		</table>
            </center>
		<table class="form">
                <input type="hidden" id="REPORT_DISPLAY" name="REPORT_DISPLAY"/>
				<input type="hidden" id="REPORT_MODULE" name="REPORT_MODULE" value="master_data"/>
                <tr>
                  <th colspan="4">
				  <div style="float: left;">${labelMap.TITLE_MAIN}</div>
				  </th>
                </tr>
				<tr>
                    <td class="label"><label for="REPORT_NAME">${labelMap.REPORT_NAME}</label>
					</td>
                    <td colspan="3" class="input">
					<select class="mediumMax" id="REPORT_FILE_NAME" name="REPORT_FILE_NAME" onChange="changeDropDownList();">
                            <option value="None">-- Select Report --</option>
                            <option value="AccountMasters">${labelMap.REPORT_ACCOUNT}</option>
                            <option value="BankMasters">${labelMap.REPORT_BANK}</option>
                            <option value="Dept_Masters">${labelMap.REPORT_DEPARTMENT}</option>
                            <option value="DoctorCateMasters">${labelMap.REPORT_DOCTOR_CATEGORY}</option>
                            <option value="DoctorMasters">${labelMap.REPORT_DOCTOR}</option>
                           <!-- <option value="DoctorTimeMasters">${labelMap.REPORT_DOCTOR_TIME}</option> -->
                            <option value="ExpenseMasters">${labelMap.REPORT_EXPENSE}</option>
                            <option value="Loc_Masters">${labelMap.REPORT_LOCATION}</option>
                            <option value="OrderItemCateMasters">${labelMap.REPORT_ORDER_ITEM_CATEGORY}</option>
                            <option value="OrderItemMasters">${labelMap.REPORT_ORDER_ITEM}</option>
							<option value="PayorOfficeMasters">${labelMap.REPORT_PAYOR_OFFICE}</option>
							<option value="ReceiptTypeMasters">${labelMap.REPORT_RECEIPT_TYPE}</option>
							<option value="StpMedhodAllocItemCatMasters">${labelMap.REPORT_STP_METHOD_ALLOC_ITEM_CATEGORY}</option>
							<option value="StpMedhodAllocItemsMasters">${labelMap.REPORT_STP_METHOD_ALLOC_ITEM}</option>
							<option value="StpMedhodAllocMasters">${labelMap.REPORT_STP_METHOD_ALLOC_MASTER}</option>
							<option value="StpMedhodAllocPersMasters">${labelMap.REPORT_STP_METHOD_ALLOC_PERSONAL}</option>
                    </select>					</td>
				</tr>
				<tr>
                    <td class="label">
                    <label for="UPDATE_FROM_DATE">${labelMap.UPDATE_FROM_DATE}</label>
                    </td>
                    <td class="input">
                    <input type="text" id="FROM_DATE" name="FROM_DATE" class="short" readonly="readonly"/>
                    <input type="image" class="image_button" src="../../images/calendar_button.png" alt="" onclick="displayDatePicker('FROM_DATE'); return false;" /> </td>
					<td class="label">
                    <label for="UPDATE_TO_DATE">${labelMap.UPDATE_TO_DATE}</label>
                    </td>
					<td class="input">
					<input type="text" id="TO_DATE" name="TO_DATE" class="short" readonly="readonly"/>
                    <input type="image" class="image_button" src="../../images/calendar_button.png" alt="" onclick="displayDatePicker('TO_DATE'); return false;" /> </td>
                </tr>
                <tr>
                    <td class="label"><label for="ACTIVE_1">${labelMap.ACTIVE}</label></td>
                    <td colspan="4" class="input">
                        <input type="radio" id="ACTIVE_1" name="ACTIVE" value="1" checked="checked" />
                        <label for="ACTIVE_1">${labelMap.ACTIVE_1}</label>
                        <input type="radio" id="ACTIVE_0" name="ACTIVE" value="0" />
                        <label for="ACTIVE_0">${labelMap.ACTIVE_0}</label>
                    </td>
                </tr>
				<tr id ="account" >
                    <td class="label"><label for="ACCOUNT_CODE">${labelMap.ACCOUNT_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="ACCOUNT_CODE" type="text" class="short" id="ACCOUNT_CODE" maxlength="20" value="" onkeypress="return ACCOUNT_CODE_KeyPress(event);"onblur="AJAX_Refresh_ACCOUNT();" />
                        <input id="SEARCH_ACCOUNT_CODE" name="SEARCH_ACCOUNT_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=ACCOUNT&DISPLAY_FIELD=DESCRIPTION&TARGET=ACCOUNT_CODE&HANDLE=AJAX_Refresh_ACCOUNT'); return false;" />
                        <input name="DESCRIPTION" type="text" class="mediumMax" id="DESCRIPTION" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr id ="bank">
                    <td class="label"><label for="BANK_CODE">${labelMap.BANK_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="BANK_CODE" type="text" class="short" id="BANK_CODE" maxlength="20" value="" onkeypress="return BANK_CODE_KeyPress(event);"onblur="AJAX_Refresh_BANK();" />
                        <input id="SEARCH_BANK_CODE" name="SEARCH_BANK_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=BANK&DISPLAY_FIELD=DESCRIPTION_<%= labelMap.getFieldLangSuffix() %>&TARGET=BANK_CODE&HANDLE=AJAX_Refresh_BANK'); return false;" />
                        <input name="BANK_NAME" type="text" class="mediumMax" id="BANK_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr id ="department">
                    <td class="label"><label for="DEPARTMENT_CODE">${labelMap.DEPARTMENT_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="DEPARTMENT_CODE" type="text" class="short" id="DEPARTMENT_CODE" maxlength="20" value="" onkeypress="return DEPARTMENT_CODE_KeyPress(event);"onblur="AJAX_Refresh_DEPARTMENT();" />
                        <input id="SEARCH_DEPARTMENT_CODE" name="SEARCH_DEPARTMENT_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=DEPARTMENT&DISPLAY_FIELD=DESCRIPTION&TARGET=DEPARTMENT_CODE&HANDLE=AJAX_Refresh_DEPARTMENT'); return false;" />
                        <input name="DEPARTMENT_NAME" type="text" class="mediumMax" id="DEPARTMENT_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                    <tr id ="doctor_cate">
                    <td class="label"><label for="DOCTOR_CATE_CODE">${labelMap.DOCTOR_CATE_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="DOCTOR_CATE_CODE" type="text" class="short" id="DOCTOR_CATE_CODE" maxlength="20" value="" onkeypress="return DOCTOR_CATE_CODE_KeyPress(event);"onblur="AJAX_Refresh_DOCTOR_CATE();" />
                        <input id="SEARCH_DOCTOR_CATE_CODE" name="SEARCH_DOCTOR_CATE_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=DOCTOR_CATEGORY&DISPLAY_FIELD=DESCRIPTION&TARGET=DOCTOR_CATE_CODE&HANDLE=AJAX_Refresh_DOCTOR_CATE'); return false;" />
                        <input name="DOCTOR_CATE_NAME" type="text" class="mediumMax" id="DOCTOR_CATE_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr id ="doctor">
                    <td class="label"><label for="DOCTOR_CODE">${labelMap.DOCTOR_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="DOCTOR_CODE" type="text" class="short" id="DOCTOR_CODE" maxlength="20" value="" onkeypress="return DOCTOR_CODE_KeyPress(event);"onblur="AJAX_Refresh_DOCTOR();" />
                        <input id="SEARCH_DOCTOR_CODE" name="SEARCH_DOCTOR_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=DOCTOR&DISPLAY_FIELD=NAME_<%= labelMap.getFieldLangSuffix() %>&TARGET=DOCTOR_CODE&HANDLE=AJAX_Refresh_DOCTOR'); return false;" />
                        <input name="DOCTOR_NAME" type="text" class="mediumMax" id="DOCTOR_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr id ="expense">
                    <td class="label"><label for="EXPENSE_CODE">${labelMap.EXPENSE_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="EXPENSE_CODE" type="text" class="short" id="EXPENSE_CODE" maxlength="20" value="" onkeypress="return EXPENSE_CODE_KeyPress(event);"onblur="AJAX_Refresh_EXPENSE();" />
                        <input id="SEARCH_EXPENSE_CODE" name="SEARCH_EXPENSE_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=EXPENSE&DISPLAY_FIELD=DESCRIPTION&TARGET=EXPENSE_CODE&HANDLE=AJAX_Refresh_EXPENSE'); return false;" />
                        <input name="EXPENSE_NAME" type="text" class="mediumMax" id="EXPENSE_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                 <tr id ="location">
                    <td class="label"><label for="LOCATION_CODE">${labelMap.LOCATION_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="LOCATION_CODE" type="text" class="short" id="LOCATION_CODE" maxlength="20" value="" onkeypress="return LOCATION_CODE_KeyPress(event);"onblur="AJAX_Refresh_LOCATION();" />
                        <input id="SEARCH_LOCATION_CODE" name="SEARCH_LOCATION_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=LOCATION&DISPLAY_FIELD=DESCRIPTION&TARGET=LOCATION_CODE&HANDLE=AJAX_Refresh_LOCATION'); return false;" />
                        <input name="LOCATION_NAME" type="text" class="mediumMax" id="LOCATION_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr id ="order_item_cate">
                    <td class="label"><label for="ORDER_ITEM_CATE_CODE">${labelMap.ORDER_ITEM_CATE_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="ORDER_ITEM_CATE_CODE" type="text" class="short" id="ORDER_ITEM_CATE_CODE" maxlength="20" value="" onkeypress="return ORDER_ITEM_CATE_CODE_KeyPress(event);"onblur="AJAX_Refresh_ORDER_ITEM_CATE();" />
                        <input id="SEARCH_ORDER_ITEM_CATE_CODE" name="SEARCH_ORDER_ITEM_CATE_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=ORDER_ITEM_CATEGORY&DISPLAY_FIELD=DESCRIPTION_<%= labelMap.getFieldLangSuffix() %>&TARGET=ORDER_ITEM_CATE_CODE&HANDLE=AJAX_Refresh_ORDER_ITEM_CATE'); return false;" />
                        <input name="ORDER_ITEM_CATE_NAME" type="text" class="mediumMax" id="ORDER_ITEM_CATE_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr id ="order_item">
                    <td class="label"><label for="ORDER_ITEM_CODE">${labelMap.ORDER_ITEM_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="ORDER_ITEM_CODE" type="text" class="short" id="ORDER_ITEM_CODE" maxlength="20" value="" onkeypress="return ORDER_ITEM_CODE_KeyPress(event);"onblur="AJAX_Refresh_ORDER_ITEM();" />
                        <input id="SEARCH_ORDER_ITEM_CODE" name="SEARCH_ORDER_ITEM_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=ORDER_ITEM&DISPLAY_FIELD=DESCRIPTION_<%= labelMap.getFieldLangSuffix() %>&TARGET=ORDER_ITEM_CODE&HANDLE=AJAX_Refresh_ORDER_ITEM'); return false;" />
                        <input name="ORDER_ITEM_NAME" type="text" class="mediumMax" id="ORDER_ITEM_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr id ="payor_office">
                    <td class="label"><label for="PAYOR_OFFICE_CODE">${labelMap.PAYOR_OFFICE_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="PAYOR_OFFICE_CODE" type="text" class="short" id="PAYOR_OFFICE_CODE" maxlength="20" value="" onkeypress="return PAYOR_OFFICE_CODE_KeyPress(event);"onblur="AJAX_Refresh_PAYOR_OFFICE();" />
                        <input id="SEARCH_PAYOR_OFFICE_CODE" name="SEARCH_PAYOR_OFFICE_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=PAYOR_OFFICE&DISPLAY_FIELD=NAME_<%= labelMap.getFieldLangSuffix() %>&TARGET=PAYOR_OFFICE_CODE&HANDLE=AJAX_Refresh_PAYOR_OFFICE'); return false;" />
                        <input name="PAYOR_OFFICE_NAME" type="text" class="mediumMax" id="PAYOR_OFFICE_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr id ="receipt_type">
                    <td class="label"><label for="RECEIPT_TYPE_CODE">${labelMap.RECEIPT_TYPE_CODE}</label></td>
                    <td class="input" colspan="3">
                        <input name="RECEIPT_TYPE_CODE" type="text" class="short" id="RECEIPT_TYPE_CODE" maxlength="20" value="" onkeypress="return RECEIPT_TYPE_CODE_KeyPress(event);"onblur="AJAX_Refresh_RECEIPT_TYPE();" />
                        <input id="SEARCH_RECEIPT_TYPE_CODE" name="SEARCH_RECEIPT_TYPE_CODE" type="image" class="image_button" src="../../images/search_button.png" alt="Search" onclick="openSearchForm('../search.jsp?TABLE=RECEIPT_TYPE&DISPLAY_FIELD=DESCRIPTION_<%= labelMap.getFieldLangSuffix() %>&TARGET=RECEIPT_TYPE_CODE&HANDLE=AJAX_Refresh_RECEIPT_TYPE'); return false;" />
                        <input name="RECEIPT_TYPE_NAME" type="text" class="mediumMax" id="RECEIPT_TYPE_NAME" readonly="readonly" value="" />                    
                    </td>
                </tr>
                <tr>
                    <td class="label"><label for="SAVE_FILE">${labelMap.SAVE_FILE}</label></td>
                    <td class="input" colspan="3"><input type="text" class="medium" id="SAVE_FILE" name="SAVE_FILE"/>
                        <select id="FILE_TYPE" name="FILE_TYPE">
                            <option value="all">all</option>
                            <option value="xls">xls</option>
                            <option value="pdf">pdf</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th colspan="4" class="buttonBar">
					<input type="button" id="SAVE" name="SAVE" class="button" value="${labelMap.SAVE}" onclick="Report_Save();" />
                    <input type="button" id="VIEW" name="VIEW" class="button" value="${labelMap.VIEW}" onclick="Report_View();" />
                    <input type="reset" id="RESET" name="RESET" class="button" value="${labelMap.RESET}" />
                  <input type="button" id="CLOSE" name="CLOSE" class="button" value="${labelMap.CLOSE}" onclick="window.location='../process/ProcessFlow.jsp'" /> 
				  </th>
                </tr>
          </table>
    </form>
	</body>
</html>
